home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / src / rot3dsrc.lha / rot3d / jiff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-24  |  2.9 KB  |  114 lines

  1.  
  2. /************ I usually put these in a file called format.h ****/
  3.  
  4. #define XMAX 320
  5. #define YMAX 200
  6. #define PLANES 5
  7. #define MAXCOL (1<<PLANES)
  8. #define XASPECT 10
  9. #define YASPECT 11
  10.  
  11. /* EA handy make a long from 4 chars macros redone to work with Aztec*/
  12. #define MAKE_ID(a, b, c, d)\
  13.     ( ((long)(a)<<24) + ((long)(b)<<16) + ((long)(c)<<8) + (long)(d) )
  14.  
  15. /* these are the IFF types I deal with */
  16. #define FORM MAKE_ID('F', 'O', 'R', 'M')
  17. #define ILBM MAKE_ID('I', 'L', 'B', 'M')
  18. #define BMHD MAKE_ID('B', 'M', 'H', 'D')
  19. #define CMAP MAKE_ID('C', 'M', 'A', 'P')
  20. #define BODY MAKE_ID('B', 'O', 'D', 'Y')
  21.  
  22. /* and these are the IFF types I ignore but don't squawk about */
  23. #define GRAB MAKE_ID('G', 'R', 'A', 'B')
  24. #define DESTI MAKE_ID('D', 'E', 'S', 'T')
  25. #define SPRT MAKE_ID('S', 'P', 'R', 'T')
  26. #define CAMG MAKE_ID('C', 'A', 'M', 'G')
  27. #define CRNG MAKE_ID('C', 'R', 'N', 'G')
  28. #define CCRT MAKE_ID('C', 'C', 'R', 'T')
  29.  
  30. /* Some macros for raster memory allocation ... redefine if you're
  31.    sensible and manage memory locally */
  32.  
  33. /* ralloc - raster alloc*/
  34. #define ralloc(amount)  (PLANEPTR)AllocMem((long)(amount), MEMF_CHIP)
  35. /* rfree - raster free*/
  36. #define rfree(pt, amount)    FreeMem( (pt), (long)(amount) )
  37.  
  38. /*line_bytes = the number of words * 2 (for bytes) a raster line takes up */
  39. #define line_bytes(width)    (((width+15)>>4)<<1)
  40.  
  41. /* psize - plane size in bytes (an even number) of a raster given
  42.    width and height */
  43. #define psize(width, height) ( line_bytes(width)*height)
  44.  
  45. /* the place to throw excess bits */
  46. #define bit_bucket(file, length) fseek(file, (long)(length), 1)
  47.  
  48.  
  49. union bytes4
  50.     {
  51.     char b4_name[4];
  52.     long b4_type;
  53.     };
  54.  
  55. struct iff_chunk
  56.     {
  57.     union bytes4 iff_type;
  58.     long iff_length;
  59.     };
  60.  
  61. struct form_chunk
  62.     {
  63.     union bytes4 fc_type; /* == FORM */
  64.     long fc_length;
  65.     union bytes4 fc_subtype;
  66.     };
  67.  
  68. struct BitMapHeader
  69.     {
  70.     UWORD w, h;
  71.     UWORD x, y;
  72.     UBYTE nPlanes;
  73.     UBYTE masking;
  74.     UBYTE compression;
  75.     UBYTE pad1;
  76.     UWORD transparentColor;
  77.     UBYTE xAspect, yAspect;
  78.     WORD pageWidth, pageHeight;
  79.     };
  80.  
  81. /*ILBM_info is the structure read_iff returns, and is hopefully all
  82.   you need to deal with out of the iff reader routines below*/
  83. struct ILBM_info
  84.     {
  85.     struct BitMapHeader header;
  86.     UBYTE cmap[MAXCOL*3];    /*say hey aztec don't like odd length structures*/
  87.     struct BitMap bitmap;
  88.     };
  89.  
  90.  
  91. /* I sure wish C function "prototypes" were real and not just ANSI */
  92. extern struct ILBM_info *read_iff();  /* read_iff( char *filename ); */
  93. extern void free_planes();        /* free_planes( struct BitMap *bitmap); */
  94. extern int write_iff();
  95. /* write_iff(char *name, unsigned char *colors, struct BitMap *bits,
  96.     short xoff, short yoff, short width, short compressed); */
  97.  
  98.  
  99. /* Anyone know where some useful minterms are defined? */
  100. #define COPY_MINTERM        0xc0
  101.  
  102. /***
  103.  
  104.         A meditation for the guru from the Diamond Sutra -
  105.  
  106.         So shall you think of all this fleeting world:
  107.         A star at dawn, a bubble in a stream;
  108.         A flash of lightning in a summer cloud,
  109.         A flickering lamp, a phantom, and a dream.
  110.  
  111. ***/
  112.  
  113.  
  114.